<?php
// sunsblog.net pocetok.inc (c)2004 - 2012 Gjokica Zafirovski

if (!$l_id) {
$l_id='1';
}
$sql = "select * from $tbl_lokacija where id='$l_id'";
$res = mysql_query ($sql)
	or die("Try again sunser lokacija!");
$row = mysql_fetch_array ($res);
?>
<?php if($l_id == '1'){ ?>
<td colspan="2">
  <iframe width="600" height="437" 
     src="http://www.youtube.com/embed/bPs9-bKVAVk" frameborder="0" allowfullscreen></iframe>
</td>
</tr>
<?php } ?>
<tr>
<td width="400" height='100%' valign="top">
<table width="400" border="0">
<tr>
<td>
<?php
if($l_id != '1'){
echo '<img src="images/'.$row['slika'].'" border="0" alt="'.$row['slika'].'" width="400" />'; 
}
/*if($l_id == 1){ ?> 
<script type="text/javascript">
sb_writeflashcode("suns_dvd_ad", "ads/suns_dvd.swf", "400", "225", "", "", "");
</script>
<? } else {
echo '<img src="images/'.$row['slika'].'" border="0" alt="'.$row['slika'].'" width="400" />'; 
}*/
?>
</td>
</tr>
<tr>
<td class="voved"><?php echo $row['voved'] ?></td>
</tr>
<?php
if ($l_id=='1'){
$blogQuery = "SELECT title, blogDate, content, user_id FROM sunsblogs order by blogDate desc limit 5";
$blogResult = mysql_query($blogQuery);
echo '<tr><td>';
while (list($title, $blogDate, $content, $user_id) = mysql_fetch_row($blogResult)) {
  $userQuery = "select ime, prezime ,suns from sunsers where id='$user_id'";
  $userResult = mysql_query($userQuery);
  $userRow = mysql_fetch_array($userResult);
  $ime = $userRow['ime'];
  $prezime = $userRow['prezime'];
  if($userRow['suns'] == 2){
    $ime = 'sunsblog';
    $prezime ='';
  }

  echo "<p class='cetivo'>".datum($blogDate)."<br/><b>$title</b><br>".str_replace("\n", "<br/>", $content)."<br><span style='color:#B70004'>$ime&nbsp;$prezime</span></p>";
}
echo '</td></tr>';
} else {
$sql = "select id,naslov,podnaslov from $tbl_sodrzina where lokacija='$l_id' order by id DESC";
$res = mysql_query ($sql)
	or die("Try again sunser sodrzina!");
while($row = mysql_fetch_array ($res)) {
echo '<tr>';
echo '<td class="naslov">';
echo '<a href="?s_id='.$row['id'].'&l_id='.$l_id.'">'.$row['naslov'].'</a>';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td class="podnaslov">';
echo $row['podnaslov'];
echo '</td>';
echo '</tr>';
}
}
?>
</table>
</td>